package com.wxtt.android.adapter;

import android.widget.AbsListView;
import android.widget.ImageView;

import com.fast.dev.frame.Adapter.listview.AdapterHolder;
import com.fast.dev.frame.Adapter.listview.BaseListAdapter;
import com.fast.dev.frame.glide.GlideLoader;
import com.fast.dev.frame.ui.V;
import com.fast.dev.frame.utils.StringUtils;
import com.wxtt.android.R;
import com.wxtt.android.bean.WxArticleBean;

import java.util.List;

/**
 * 说明：文章列表
 * <p/>
 * 作者：fanly
 * <p/>
 * 时间：2016/2/17 15:43
 * <p/>
 * 版本：verson 1.0
 */
public class ArticleAdapter extends BaseListAdapter<WxArticleBean> {

    private AbsListView lv;

    public ArticleAdapter(AbsListView view, List<WxArticleBean> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
        lv = view;
    }

    @Override
    public void convert(AdapterHolder holder, WxArticleBean item, boolean isScrolling, int position) {
        ImageView iv = holder.getView(R.id.iv_item_firstpic);
        if (!StringUtils.isEmpty(item.getFirstImg())){
            GlideLoader.into(item.getFirstImg(), iv, R.mipmap.place_pic, R.mipmap.error_pic);
        }else {
            V.GONE(iv);
        }
        holder.setText(R.id.tv_item_title, item.getTitle());
        holder.setText(R.id.tv_item_source, item.getSource());

    }
}
